# list增加
a1 = [1, 2]
a1.append(3)
print(a1)

a2 = [1, 2]
a3 = [3, 4]
a2 += a3
print(a2)

a3 = "bala "
print(a3 * 10)

a4 = [1, 3]
a4.insert(1, 2)
print(a4)


# list检索
b1 = [1, 2, 3, 4, 5, 6, 7]
print(b1[0:2])
print(b1[1:7:2])


# list更新
c1 = [1, 2, 3, 4, 5, 6, 7]
c1[1] = 1.1
print(c1)

c2 = [1, 2, 3, 4, 5, 6, 7]
c2[0:2] = (1,)
print(c2)


# list删除
d1 = [1, 2, 3, 4, 5, 6, 7]
d2 = d1.pop()
print(d1)
print(d2)

d1.clear()
print(d1)


# list排序
e1 = [3, 1, 7, 9, 5]
e1.sort()
print(e1)

e2 = [3, 1, 7, 9, 5]
e3 = sorted(e2)
print(e3)

e4 = [3, 1, 7, 9, 5]
e4.reverse()
print(e4)

e5 = [3, 1, 7, 9, 5]
e6 = list(reversed(e5))
print(e6)


# dict增加
f1 = {"one": 1, "two": 2}
f2 = {"three":3}
f1.update(f2)
print(f1)

f3 = {"one": 1, "two": 2, "three": 3}
f4 = f3.setdefault("two", 4)
print(f4)

f5 = {"one": 1, "two": 2, "three": 3}
f5.setdefault("four", 4)
print(f5)


# dict检索
j1 = {"one": 1, "two": 2, "three": 3, "four": 4}
j2 = j1.get("four")
print(j2)
j3 = j1.get("five")
print(j3)
print(j1["two"])

j5 = j1.values()
print(j5)
j6 = j1.items()
print(j6)


# dict更新
h1 = {"one": 1, "two": 2, "three": 3, "four": 4}
h1["one"] = "one"
print(h1)

h1.update({"two": "two", "three": "three", "four": "four"},)
print(h1)


# dict删除
i1 = {"one": "1", "two": 2, "three": 3, "four": 4}
i1.pop("four")
print(i1)

i1 = {"one": "1", "two": 2, "three": 3}
i2 = i1.popitem()
print(i1)
print(i2)


# set增加
l1 = {1, 2}
l1.add(3)
print(l1)


# set检索
m1 = {"one", "two"}
print("one" in m1)


# set更新
n1 = {1, 2}
n1.update({3})
print(n1)

n2 = {1, 2}
n3 = {3, 4}
n4 = n2.union(n3)
print(n4)


# set删除
o1 = {'one', 'two', 'three'}
o2 = o1.pop()
print(o1)
print(o2)

o3 = {'one', 'two', 'three'}
o3.remove("one")
print(o3)
